/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.fee.core.domain.action;

import info.peigen.hotpot.business.account.facade.enums.AccountFeeAction;
import info.peigen.hotpot.business.account.facade.order.trans.fee.FeeOrderInfo;
import info.peigen.hotpot.business.fee.core.domain.Fee;

/**
 * <b>(FeeOrderInfoConvertor)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/9/6
 */
public class FeeOrderInfoConvertor {
    public static FeeOrderInfo convert(Fee fee) {
        return FeeOrderInfo.builder().payerAccountId(fee.getChargeAccount().getAccountId())
                .payeeAccountId(fee.getFeeAccount().getAccountId())
                .feeAmount(fee.getFeeAmount())
                .feeProductCode(fee.getCode().code())
                .build();
    }

    public static FeeOrderInfo convert(Fee fee, AccountFeeAction action) {
        return FeeOrderInfo.builder().payerAccountId(fee.getChargeAccount().getAccountId())
                .payeeAccountId(fee.getFeeAccount().getAccountId())
                .feeAmount(fee.getFeeAmount())
                .action(action)
                .feeProductCode(fee.getCode().code())
                .build();
    }
}